package org.domain.acount.session;

import org.domain.acount.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("usuarioHasPapelHome")
public class UsuarioHasPapelHome extends EntityHome<UsuarioHasPapel> {

	public void setUsuarioHasPapelId(UsuarioHasPapelId id) {
		setId(id);
	}

	public UsuarioHasPapelId getUsuarioHasPapelId() {
		return (UsuarioHasPapelId) getId();
	}

	public UsuarioHasPapelHome() {
		setUsuarioHasPapelId(new UsuarioHasPapelId());
	}

	@Override
	public boolean isIdDefined() {
		if (getUsuarioHasPapelId().getUsuarioUsername() != null)
			return false;
		if (getUsuarioHasPapelId().getPapelIdPapel() == 0)
			return false;
		return true;
	}

	@Override
	protected UsuarioHasPapel createInstance() {
		UsuarioHasPapel usuarioHasPapel = new UsuarioHasPapel();
		usuarioHasPapel.setId(new UsuarioHasPapelId());
		return usuarioHasPapel;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public UsuarioHasPapel getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
